import request from '@/config/axios'

export interface MailboxVO {
  title: string
  mailboxCategory: number
  contactNumber: number
  content: string
  isNoted: number
  ipAddress: string
  attFileName: string
}

// 查询在线信箱列表
export const getMailboxPage = async (params: MailboxPageReqVO) => {
  return await request.get({ url: 'online/mailbox/page', params })
}

// 查询在线信箱详情
export const getMailbox = async (id: number) => {
  return await request.get({ url: 'online/mailbox/get?id=' + id })
}

// 新增在线信箱
export const createMailbox = async (data: MailboxVO) => {
  return await request.post({ url: 'online/mailbox/create', data })
}

// 修改在线信箱
export const updateMailbox = async (data: MailboxVO) => {
  return await request.put({ url: 'online/mailbox/update', data })
}

// 删除在线信箱
export const deleteMailbox = async (id: number) => {
  return await request.delete({ url: 'online/mailbox/delete?id=' + id })
}

// 导出在线信箱 Excel
export const exportMailbox = async (params) => {
  return await request.download({ url: 'online/mailbox/export-excel', params })
}

// 修改在线信箱阅读状态
export const updateMailboxReadStatus = async (id: number) => {
  return await request.put({ url: 'online/mailbox/update-read-status?id=' + id })
}
